home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / security / crack_4.1-tar / Scripts / shadmrg < prev    next >
Encoding:
Text File  |  1992-06-25  |  948 b   |  51 lines

  1. #!/bin/sh
  2.  
  3. ###
  4. # This program is copyright Alec Muffett 1991, and is provided as part of
  5. # the Crack v4.0 Password Cracking package.  The author disclaims all
  6. # responsibility or liability with respect to it's usage or its effect
  7. # upon hardware or computer systems, and maintains copyright as set out in
  8. # the "LICENCE" document which accompanies distributions of Crack v4.0 and
  9. # upwards. So there...
  10. ###
  11.  
  12. shadow=/etc/shadow
  13. passwd=/etc/passwd
  14.  
  15. ###
  16. # Merge /etc/shadow & /etc/passwd for Crack.  Assume 7 fields for /etc/passwd,
  17. # and other for /etc/shadow
  18. ###
  19.  
  20. cat $passwd $shadow |
  21. awk -F: '
  22. BEGIN {
  23.     OFS = ":";
  24. }
  25.  
  26. NF == 7 {
  27.     pwents[$1] = $0;
  28. }
  29.  
  30. NF != 7 {
  31.     shadow_pw[$1] = $2;
  32. }
  33.  
  34. END {
  35.     for (pw_name in pwents)
  36.     {
  37.         fields = split(pwents[pw_name], pwd, ":");
  38.  
  39.         if (shadow_pw[pwd[1]] != "LOCKED")
  40.         {
  41.             print     pwd[1], \
  42.                 shadow_pw[pwd[1]], \
  43.                 pwd[3], \
  44.                 pwd[4], \
  45.                     pwd[5], \
  46.                     pwd[6], \
  47.                     pwd[7];
  48.         }
  49.     }
  50. }'
  51.